#pragma once
#include <QObject>
#include <qbmessage/include/message_sync.h>

class MessagePusher : public QObject,
					public CUnknownObject<IMessageDispatchObserver>
{
	Q_OBJECT

	struct kPushData
	{
		kPushData() : pRecvData(NULL), nRecvLen(0), flag(0), tag(NULL) {}
		char* pRecvData;
		int nRecvLen;
		uint32_t flag;
		void* tag;
	};
public:
	MessagePusher(IMessageSync*);
	~MessagePusher();

public slots:
	void OnPushData(void* data);

signals:
	void push_data(void* data);

protected:
	STDMETHOD_(void, PushMessage) (const char* pRecvData, int nDataLen, uint32_t flag, void* tag);

private:
	IMessageSync* m_sync = nullptr;
};